package com.core;

import java.util.HashMap;

import com.model.KeyValue;

public class KeyValueDictionary
        extends HashMap <String, Object> {

    /**
     * 
     */
    private static final long serialVersionUID = 1L;
    private KeyValue          defaultValue;



    public KeyValue getDefaultValue () {

        return defaultValue;
    }



    public void setDefaultValue ( KeyValue defaultValue ) {

        this.defaultValue = defaultValue;
    }



    public String toStringWithSeparator ( String separator ) {

        StringBuilder sb = new StringBuilder();

        boolean separated = false;
        for ( String key : this.keySet() ) {
            if ( separated ) {
                sb.append(String.format("%s%s", separator, this.get(key)));
            } else {

                sb.append(String.format("%s", this.get(key)));
                separated = true;
            }
        }

        return sb.toString();
    }
}
